package xyz.zdsoft.project_group_manage_module.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.zdsoft.common.utils.Result;
import xyz.zdsoft.project_group_manage_module.entity.TeamMemberInfo;
import xyz.zdsoft.project_group_manage_module.mapper.InsertStudentToTeamGchMapper;
import javax.annotation.Resource;

@RestController
@Api(tags = "项目组管理")
public class Admin_InsertStudentToTeamController {
    @Resource
    private InsertStudentToTeamGchMapper insertStudentToTeamGchMapper;

    @ApiOperation("项目组添加学员")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "teamInfoId",value = "小组id",required = true,example ="1"),
            @ApiImplicitParam(name = "studentId",value = "学生id",required = true,example = "1")
    })
    @PostMapping("/InsertStudentToTeam")
    public Result insertStudentToTeam(Long teamInfoId, Long studentId){
        TeamMemberInfo t=new TeamMemberInfo();
        t.setTeamInfoId(teamInfoId);
        t.setStudentId(studentId);
        if (insertStudentToTeamGchMapper.insert(t)>0){
            return Result.ok().message("新增成功");
        }
        else return Result.error().message("新增失败");

    }

}
